const root = {
    val: 'A',
    left: {
        val: 'B',
        left: {
            val: 'D',
        },
        right: {
            val: 'E',
        }
    },
    right: {
        val: 'C',
        left: {
            val: 'F',
        }
    }
}
//前序遍历
function preorder(root) {
    if (!root) {
        return
    }
    console.log(root.val);
    preorder(root.left)
    preorder(root.right)
}
//中序遍历
function inorder(root) {
    if (!root) {
        return
    }
    inorder(root.left)
    console.log(root.val);
    inorder(root.right)
}
inorder(root)
//后续遍历
function postorder(root) {
    if (!root) return
    postorder(root.left)
    postorder(root.right)
    console.log(root.val);
}
